Jas (Matthew K) wrote this... > > to all you coders out there be aware file locking behaves differently > for NFS file systems under solaris 2.4... be warned doing a ufs file > lock on a NFS file makes fcntl() hang.. it doesnt return an error, it > hangs. > anyway here is a snippet of code that does a work around.. > > instead of > fcntl(fd,F_SETLK,&info); > try this.. > struct statvfs vfsbuf; > cmd=F_SETLK; > if(!fstatvfs(fd,&vfsbuf)&&!strcmp("nfs",vfsbuf.f_basetype)) > cmd=F_RSETLK; > fcntl(fd,cmd,&info); > > hope this helps.. > > Matt ooops i goofed i just realised.. it should have been F_SETLKW and F_RSETLKW, they do an atomic wait and set lock.. but a ufs lock will never occur on a NFS fd, so the net effect is that fcntl(nfsfd,F_SETLKW,&foo) will never return... :| rather agrivating.. i think it would be much better if it returned -1 EINVAL *shrug* Matt -- #!/bin/sh echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D3F204445524F42snlbxq'|dc;exit Matthew Keenan Systems Programmer Information Technology Division University of Technology Sydney Australia It's nice to be in a position where people apologize because they assume there's humor in your work, based on past experience, but they're not sure where it is. -- Rob Pike